#!/usr/bin/env python3
# coding=utf-8
import maya.cmds as cmds
import os
import sys
import Sync_Tools_Editor
#sys.path.append("J:/Deliverer_Tools/Maya/Menus")		
class Tools_Menu():   
	def Run(self):
		#get_program_path = 'D:/Cling_toolbox'
		
		current_file = __file__
		icon_dir = os.path.join(os.path.dirname(current_file),"icon")
		#get_script_dir = get_program_path
		
		Layout = cmds.formLayout("ToolBox|MainToolboxLayout", q=True,childArray=1)
		DelivererToolboxLayout = "Deliverer_ToolsBoxLayout"
		ToolBoxLayout = Layout[0]
		#mayaWebButtonLayout =  Layout[1]
		
		if cmds.iconTextButton('mayaWebButton',exists=1):
			cmds.deleteUI('mayaWebButton')
		if cmds.columnLayout(DelivererToolboxLayout,exists=1):
			cmds.deleteUI(DelivererToolboxLayout)
			
		NewButtonLayout = cmds.columnLayout(DelivererToolboxLayout,parent = "ToolBox|MainToolboxLayout")#
		#cmds.iconTextButton(mayaWebButtonLayout,e=1,visible=0)
		#cmds.iconTextRadioCollection( 'itRadCollection' )

		Sync_Pipeline_menu = cmds.iconTextButton( h=36,w=36,style='iconOnly', image1=os.path.join(icon_dir,'Sync_Pipeline.png'),annotation=u'主菜单')
		Check_Pipeline_menu = cmds.iconTextButton( h=36,w=36,style='iconOnly', image1=os.path.join(icon_dir,'Check_Pipeline.png'),annotation=u'检查')
		Tools_Pipeline_menu = cmds.iconTextButton( h=36,w=36,style='iconOnly', image1=os.path.join(icon_dir,'Tools_Pipeline.png'),annotation=u'工具')
		Setting_Pipeline_menu = cmds.iconTextButton( h=36,w=36,style='iconOnly', image1=os.path.join(icon_dir,'Setting.png'),annotation=u'意见反馈')


		cmds.formLayout("ToolBox|MainToolboxLayout",edit=1,
		attachForm =[(ToolBoxLayout,"top" ,5),(ToolBoxLayout,"left" ,5),(NewButtonLayout,"left",1),(NewButtonLayout,"right",1),(NewButtonLayout,"bottom",1)],
		attachControl=[(ToolBoxLayout,"bottom" ,5,NewButtonLayout)],
		attachNone=[(ToolBoxLayout,"right" ),( NewButtonLayout, "top")])
		'''
		cmds.iconTextButton (Sync_Pipeline_menu, e=1, command=lambda *args : Sync_Tools_Editor.Sync_Pipeline ())
		cmds.iconTextButton (Check_Pipeline_menu, e=1, command=lambda *args : Sync_Tools_Editor.Check_Pipeline ())
		cmds.iconTextButton (Tools_Pipeline_menu, e=1, command=lambda *args : Sync_Tools_Editor.Tools_Pipeline ())
		cmds.iconTextButton (Setting_Pipeline_menu, e=1, command=lambda *args : Sync_Tools_Editor.Setting_Pipeline ())
		'''
		get_program_path  = os.path.abspath(__file__)
		cmds.iconTextButton( Sync_Pipeline_menu,e = 1,command = 'execfile("' + os.path.join(get_program_path, 'scripts/Cling_toolbox.py') + '")')
		cmds.iconTextButton( Check_Pipeline_menu,e = 1,command = lambda *args: Sync_Tools_Editor.Check_Pipeline())
		cmds.iconTextButton( Tools_Pipeline_menu ,e = 1,command = lambda *args: Sync_Tools_Editor.Tools_Pipeline())
		cmds.iconTextButton( Setting_Pipeline_menu ,e = 1,command = lambda *args: Sync_Tools_Editor.Setting_Pipeline())
		'''
		cmds.iconTextRadioButton( menu_item ,e=1,cc='execfile("' + os.path.join(get_program_path, 'scripts/Cling_toolbox.py') + '")')
		
		cmds.popupMenu( parent=menu_item)
		cmds.menuItem(label=u'动画工具架',command =  lambda *args: self.DepartmentBox())
		cmds.menuItem(label=u'灯光工具架',command='execfile("' + os.path.join(get_program_path, 'scripts/Cling_toolbox.py') + '")')
		cmds.menuItem(label=u'模型工具架',command='execfile("' + os.path.join(get_program_path, 'scripts/Cling_toolbox.py') + '")')
		cmds.menuItem(label=u'材质工具架',command='execfile("' + os.path.join(get_program_path, 'scripts/Cling_toolbox.py') + '")')
		cmds.menuItem(label=u'特效工具架',command='execfile("' + os.path.join(get_program_path, 'scripts/Cling_toolbox.py') + '")')
		cmds.menuItem(label=u'结算工具架',command='execfile("' + os.path.join(get_program_path, 'scripts/Cling_toolbox.py') + '")')
		'''
'''
import sys
sys.path.append("J:/Deliverer_Tools/Maya/Menus")
import MainToolbox
Tools_Menu().Run()
'''